<include file="Common:header" />
<TYimport plugin='datepicker' />
<TYimport plugin='Ueditor,swfUpload' public="true"/>
<div class="table_content" >
    <form action="{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME)}" method="post"  class="ajax_form">
        <table class="edit_table">
            <tr>
                <td class="tablehead">标题</td>
                <td>
                    <input type="text" name="title" id="title" class="text w150 required" value="{$postInfo['title']}"/><label class="tips"></label>
                </td>
            </tr>         
        <!--
        	<tr>
                <td class="tablehead">主题类型</td>
                <td>
                    <select name="areas_id" class="w150">
                        <foreach name="areasList" item="vo">
                            <option value="{$vo.id}" {$userInfo['shop_id'] == $vo['id'] ? 'selected' : ''}>{$vo.areas_name}</option>
                        </foreach>
                    </select>
                </td>
            </tr>
        -->
            
            
            <!-- <tr>
                <td class="tablehead">是否置顶</td>
                <td>
                	<span class="radio">
                        <input type="radio" id="radio1" name="is_top" value="1" <if condition="is_null($postInfo['is_top']) or ($postInfo['is_top'] eq 1)">checked</if> /><label for="radio1">开启</label>
                        <input type="radio" id="radio2" name="is_top" value="0" <if condition="!is_null($postInfo['is_top']) and ($postInfo['is_top'] eq 0)">checked</if> /><label for="radio2">关闭</label>
                    </span>
                </td>
            </tr>
            <tr>
                <td class="tablehead">是否热门</td>
                <td>
                	<span class="radio">
                		<input type="radio" id="radio3" name="is_hot" value="1" <if condition="is_null($postInfo['is_hot']) or ($postInfo['is_hot'] eq 1)">checked</if> /><label for="radio3">开启</label>
                        <input type="radio" id="radio4" name="is_hot" value="0" <if condition="!is_null($postInfo['is_hot']) and ($postInfo['is_hot'] eq 0)">checked</if> /><label for="radio4">关闭</label>
                    </span>
                </td>
            </tr>
            <tr>
                <td class="tablehead">是否精品</td>
                <td>
                	<span class="radio">
                        <input type="radio" id="radio5" name="is_essence" value="1" <if condition="is_null($postInfo['is_essence']) or ($postInfo['is_essence'] eq 1)">checked</if> /><label for="radio5">开启</label>
                        <input type="radio" id="radio6" name="is_essence" value="0" <if condition="!is_null($postInfo['is_essence']) and ($postInfo['is_essence'] eq 0)">checked</if> /><label for="radio6">关闭</label>
                    </span>
                </td>
            </tr> -->
            <tr>
            	<td class="tablehead">状态</td>
                <td>
                	<span class="radio">
                        <input type="radio" id="radio7" name="status" value="1" <if condition="is_null($postInfo['status']) or ($postInfo['status'] eq 1)">checked</if> /><label for="radio7">开启</label>
                        <input type="radio" id="radio8" name="status" value="0" <if condition="!is_null($postInfo['status']) and ($postInfo['status'] eq 0)">checked</if> /><label for="radio8">关闭</label>
                    </span>
                </td>
            </tr>
            <tr>
            	 <td class="tablehead">时间</td>
            	 <td>
            	 	开始时间：<input type="text" class="text w150" name="start_time" value='{$postInfo[start_time]|date="Y-m-d  H:i:s",###}' onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>&nbsp;&nbsp;&nbsp;&nbsp;
            	        结束时间：<input type="text" class="text w150"  name="end_time"  value='{$postInfo[end_time]|date="Y-m-d  H:i:s",###}' onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" /></td>
            </tr>
            <tr>
                <td class="tablehead">帖子内容</td>
                <td>
                	<textarea name="comment" id="content">{$postInfo['comment']}</textarea>
                </td>
            </tr>
        </table>
        <div class="tab_box_btn">
            <input type="hidden" id="id" name="id" value="{$postInfo['id']}"/>
            <input type="button" class="save_btn" value="保存"/>
            <input type="button" class="back_btn" value="返回"/>
        </div>
    </form>
</div>
<script type="text/javascript">



window.onload = function () {
    window.UEDITOR_CONFIG.initialFrameWidth = 800;
    window.UEDITOR_CONFIG.initialFrameHeight = 400;
    window.UEDITOR_CONFIG.imagePath = "http://{$Think.server.HTTP_HOST}/";
    window.UEDITOR_CONFIG.imageManagerPath = "http://{$Think.server.HTTP_HOST}/";
    UE.getEditor('content');
    
};




$('input.save_btn').click(function () {
	if($("#title").val()==""){
		callBackTips(0, '标题不能为空');
		return;
	}
	if($("input[name='start_time']").val()==""){
		callBackTips(0, '开始时间不能为空');
		return;
	}
	if($("input[name='end_time']").val()==""){
		callBackTips(0, '结束时间不能为空');
		return;
	}
	$("#reviewww").val()
    $(this).tyAjax({
        callBack: function (data) {
            callBackTips(data.status, data.info, data.url);
        }
    });
});





/* $(".save_btn").click(function(){
	//var id = $("#id").val();
	var title = $("#title").val();
	var textarea = $('textarea').text();
	
	alert($("#content").val());
	return;
	if($('#radio1').prop("checked")){
		var is_top = $('#radio1').val();
	}else{
		var is_top = $('#radio2').val();
	}
	if($('#radio3').prop("checked")){
		var is_hot = $('#radio3').val();
	}else{
		var is_hot = $('#radio4').val();
	}
	if($('#radio5').prop("checked")){
		var is_essence = $('#radio5').val();
	}else{
		var is_essence = $('#radio6').val();
	}
	if($('#radio7').prop("checked")){
		var status = $('#radio7').val();
	}else{
		var status = $('#radio8').val();
	}
	$.ajax({
		url:"{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/add_announcement')}",
		type: 'post', 
		dataType: 'json', 
		//data: {id:id,title:title,is_top:is_top,is_hot:is_hot,is_essence:is_essence,textarea:textarea},
		data: {title:title,is_top:is_top,is_hot:is_hot,is_essence:is_essence,status:status,textarea:textarea},
		success:function(data){
			if (data.status == 1){
    			callBackTips(data.status, data.info,data.url);
    		}
			else{
    			callBackTips(data.status, data.info);
    		}
		}
	});
}); */
</script>
<include file="Common:footer" />